﻿@using UCosmic.Www.Mvc.Areas.InstitutionalAgreements.Models.ConfigurationForms
@model InstitutionalAgreementConfigurationForm
<div id="institutional_agreement_configurator" data-configuration-id="@Html.IdFor(m => m.EntityId)">
    <fieldset>
        <legend>Agreement types</legend>
        <p>
            When working with institutional agreement data, users are required to specify the
            <em>Agreement type</em>. By default this field allows users to type any text, and
            a drop-down arrow can be used to suggest examples. You can override this behavior
            and restrict <em>Agreement type</em> options allowed for users in your organization.
        </p>
        <table class="page page-50-50">
            <tbody>
                <tr>
                    <td class="left">
                        <div>
                            @Html.ValidationMessageFor(m => m.AllowedTypeValues)
                        </div>
                        <div>
                            @Html.ValidationMessageFor(m => m.EntityId)
                        </div>
                        <ul id="allowed_types_list" class="listbox" data-value-type="@typeof(InstitutionalAgreementTypeValueForm)"
                            data-new-value-url="@Url.Action(MVC.InstitutionalAgreements.ConfigurationForms.NewAgreementType(Model.EntityId))" 
                            data-validate-duplicate-url="@Url.Action(MVC.InstitutionalAgreements.ConfigurationForms.ValidateDuplicateOption())">
                            @foreach (var allowedTypeValue in Model.AllowedTypeValues)
                            {
                                @Html.EditorFor(m => allowedTypeValue, MVC.InstitutionalAgreements.ConfigurationForms.Views.EditorTemplates.InstitutionalAgreementTypeValueForm)
                            }
                        </ul>
                    </td>
                    <td class="center">
                    </td>
                    <td class="right">
                        <p style="margin: 0; padding: 0;">
                            Should your users be allowed to enter custom values for Agreement type?
                        </p>
                        <div>
                            @Html.RadioButtonFor(m => m.IsCustomTypeAllowed, true,
                            new
                            {
                                id = string.Format("{0}_{1}", Html.IdFor(m => m.IsCustomTypeAllowed), true),
                                @class = "option-restriction",
                            })
                            <label for="@string.Format("{0}_{1}", Html.IdFor(m => m.IsCustomTypeAllowed), true)">
                                Yes, allow my users to enter any text for Agreement type.
                            </label>
                        </div>
                        <div>
                            @Html.RadioButtonFor(m => m.IsCustomTypeAllowed, false,
                            new
                            {
                                id = string.Format("{0}_{1}", Html.IdFor(m => m.IsCustomTypeAllowed), false),
                                @class = "option-restriction",
                            })
                            <label for="@string.Format("{0}_{1}", Html.IdFor(m => m.IsCustomTypeAllowed), false)">
                                No, restrict my users to specific Agreement types.
                            </label>
                        </div>
                        <p style="padding-bottom: 0; margin-bottom: 0;">
                            What will users see?
                        </p>
                        <div class="input combobox @Html.IdFor(m => m.ExampleTypeInput)-field">
                            @Html.EditorFor(m => m.ExampleTypeInput)
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <fieldset>
        <legend>Current statuses</legend>
        <p>
            When working with institutional agreement data, users are required to specify the
            <em>Current status</em>. By default this field allows users to type any text, and
            a drop-down arrow can be used to suggest examples. You can override this behavior
            and restrict <em>Current status</em> options allowed for users in your organization.
        </p>
        <table class="page page-50-50">
            <tbody>
                <tr>
                    <td class="left">
                        <div>
                            @Html.ValidationMessageFor(m => m.AllowedStatusValues)
                        </div>
                        <ul id="allowed_status_list" class="listbox" data-value-type="@typeof(InstitutionalAgreementStatusValueForm)"
                            data-new-value-url="@Url.Action(MVC.InstitutionalAgreements.ConfigurationForms.NewAgreementStatus(Model.EntityId))" 
                            data-validate-duplicate-url="@Url.Action(MVC.InstitutionalAgreements.ConfigurationForms.ValidateDuplicateOption())">
                            @foreach (var allowedStatusValue in Model.AllowedStatusValues)
                            {
                                @Html.EditorFor(m => allowedStatusValue, MVC.InstitutionalAgreements.ConfigurationForms.Views.EditorTemplates.InstitutionalAgreementStatusValueForm)
                            }
                        </ul>
                    </td>
                    <td class="center">
                    </td>
                    <td class="right">
                        <p style="margin: 0; padding: 0;">
                            Should your users be allowed to enter custom values for Current status?
                        </p>
                        <div>
                            @Html.RadioButtonFor(m => m.IsCustomStatusAllowed, true,
                            new
                            {
                                id = string.Format("{0}_{1}", Html.IdFor(m => m.IsCustomStatusAllowed), true),
                                @class = "option-restriction",
                            })
                            <label for="@string.Format("{0}_{1}", Html.IdFor(m => m.IsCustomStatusAllowed), true)">
                                Yes, allow my users to enter any text for Agreement status.
                            </label>
                        </div>
                        <div>
                            @Html.RadioButtonFor(m => m.IsCustomStatusAllowed, false,
                            new
                            {
                                id = string.Format("{0}_{1}", Html.IdFor(m => m.IsCustomStatusAllowed), false),
                                @class = "option-restriction",
                            })
                            <label for="@string.Format("{0}_{1}", Html.IdFor(m => m.IsCustomStatusAllowed), false)">
                                No, restrict my users to specific Current statuses.
                            </label>
                        </div>
                        <p style="padding-bottom: 0; margin-bottom: 0;">
                            What will users see?
                        </p>
                        <div class="input combobox @Html.IdFor(m => m.ExampleStatusInput)-field">
                            @Html.EditorFor(m => m.ExampleStatusInput)
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <fieldset>
        <legend>Contact types</legend>
        <p>
            When adding an institutional agreement contact, users are required to specify the
            <em>Contact type</em>. By default this field allows users to type any text, and
            a drop-down arrow can be used to suggest examples. You can override this behavior
            and restrict <em>Contact type</em> options allowed for users in your organization.
        </p>
        <table class="page page-50-50">
            <tbody>
                <tr>
                    <td class="left">
                        <div>
                            @Html.ValidationMessageFor(m => m.AllowedContactTypeValues)
                        </div>
                        <ul id="allowed_contacttype_list" class="listbox" data-value-type="@typeof(InstitutionalAgreementContactTypeValueForm)"
                            data-new-value-url="@Url.Action(MVC.InstitutionalAgreements.ConfigurationForms.NewAgreementContactType(Model.EntityId))" 
                            data-validate-duplicate-url="@Url.Action(MVC.InstitutionalAgreements.ConfigurationForms.ValidateDuplicateOption())">
                            @foreach (var allowedContactTypeValue in Model.AllowedContactTypeValues)
                            {
                                @Html.EditorFor(m => allowedContactTypeValue, MVC.InstitutionalAgreements.ConfigurationForms.Views.EditorTemplates.InstitutionalAgreementContactTypeValueForm)
                            }
                        </ul>
                    </td>
                    <td class="center">
                    </td>
                    <td class="right">
                        <p style="margin: 0; padding: 0;">
                            Should your users be allowed to enter custom values for Agreement contact type?
                        </p>
                        <div>
                            @Html.RadioButtonFor(m => m.IsCustomContactTypeAllowed, true,
                                new
                                {
                                    id = string.Format("{0}_{1}", Html.IdFor(m => m.IsCustomContactTypeAllowed), true),
                                    @class = "option-restriction",
                                })
                            <label for="@string.Format("{0}_{1}", Html.IdFor(m => m.IsCustomContactTypeAllowed), true)">
                                Yes, allow my users to enter any text for Contact type.
                            </label>
                        </div>
                        <div>
                            @Html.RadioButtonFor(m => m.IsCustomContactTypeAllowed, false,
                            new
                            {
                                id = string.Format("{0}_{1}", Html.IdFor(m => m.IsCustomContactTypeAllowed), false),
                                @class = "option-restriction",
                            })
                            <label for="@string.Format("{0}_{1}", Html.IdFor(m => m.IsCustomContactTypeAllowed), false)">
                                No, restrict my users to specific Contact types.
                            </label>
                        </div>
                        <p style="padding-bottom: 0; margin-bottom: 0;">
                            What will users see?
                        </p>
                        <div class="input combobox @Html.IdFor(m => m.ExampleContactTypeInput)-field">
                            @Html.EditorFor(m => m.ExampleContactTypeInput)
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <div class="hidden-input">
        @Html.EditorFor(m => m.RevisionId)
        @Html.EditorFor(m => m.EntityId)
    </div>
</div>
